package com.jhs.kjs.service.impl;

import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.jhs.kjs.dto.CarDTO;
import com.jhs.kjs.dto.CustomerDTO;
import com.jhs.kjs.dto.CustomerUserDTO;
import com.jhs.kjs.dto.emma.EmSmtTranDTO;
import com.jhs.kjs.dto.emma.EmmaDTO;
import com.jhs.kjs.service.IEmmaCommonService;
import com.jhs.kjs.service.dao.IEmmaCommonMapper;

public class EmmaCommonServiceImpl implements IEmmaCommonService{

	private IEmmaCommonMapper mapper;

	public void setMapper(IEmmaCommonMapper mapper) {
		this.mapper = mapper;
	}

	public List<EmSmtTranDTO> test() throws Exception{
		return this.mapper.test();
	}

	@Override
	public void sendSMS(EmSmtTranDTO em) throws Exception {
		this.mapper.sendSMS(em);
	}

	@Override
	public List<EmSmtTranDTO> getSmsHistory(CarDTO param) {
		Calendar cal = Calendar.getInstance();
		// 시작 201308부터
		// 끝 오늘 월 까지.
		List<String> tname = this.mapper.exsistLog();
		
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("car", param);
		map.put("tlist", tname);
		return this.mapper.getSmsHistory(map);
	}

	@Override
	public int getNowSentSmsCnt(EmmaDTO emma) throws Exception {
		return mapper.getNowSentSmsCnt(emma);
	}

	@Override
	public int getCustomerSerivceValue(EmmaDTO emma) throws Exception {
		return mapper.getCustomerSerivceValue(emma);
	}

	@Override
	public CustomerDTO getCustomer(CustomerUserDTO user) throws Exception {
		return mapper.getCustomer(user);
	}
}
